WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
hardware_base.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21// Fwd dependencies
22namespace wolf
23{
24class Problem;
25class SensorBase;
26} // namespace wolf
27
28// Wolf includes
29#include "core/common/wolf.h"
31
32namespace wolf
33{
34// class HardwareBase
35class HardwareBase : public NodeBase, public std::enable_shared_from_this<HardwareBase>
36{
37 friend SensorBase;
38
39 private:
40 SensorBasePtrList sensor_list_;
41
42 public:
44 ~HardwareBase() override;
45 bool hasChildren() const override;
46
47 SensorBaseConstPtrList getSensorList() const;
48 SensorBasePtrList getSensorList();
49
53 SensorBaseConstPtr getSensor(const std::string& _sensor_name) const;
54 SensorBasePtr getSensor(const std::string& _sensor_name);
55
56 virtual void printHeader(int depth, //
57 bool factored_by, //
58 bool metric, //
59 bool state_blocks,
60 std::ostream& stream,
61 std::string _tabs = "") const;
62 void print(int depth, //
63 bool factored_by, //
64 bool metric, //
65 bool state_blocks,
66 std::ostream& stream = std::cout,
67 std::string _tabs = "") const;
68
69 virtual CheckLog localCheck(bool _verbose, std::ostream& _stream, std::string _tabs = "") const;
70 bool check(CheckLog& _log, bool _verbose, std::ostream& _stream, std::string _tabs = "") const;
71
72 private:
73 virtual SensorBasePtr addSensor(SensorBasePtr _sensor_ptr);
74};
75
76} // namespace wolf
77
78// IMPLEMENTATION
79
80namespace wolf
81{
82inline SensorBaseConstPtrList HardwareBase::getSensorList() const
83{
84 SensorBaseConstPtrList list_const;
85 for (auto&& obj_ptr : sensor_list_) list_const.push_back(obj_ptr);
86 return list_const;
87}
88
89inline SensorBasePtrList HardwareBase::getSensorList()
90{
91 return sensor_list_;
92}
93
94inline bool HardwareBase::hasChildren() const
95{
96 return not sensor_list_.empty();
97}
98
99} // namespace wolf
Definition: check_log.h:28
Definition: hardware_base.h:36
SensorBaseConstPtr getSensor(const std::string &_sensor_name) const
get a sensor pointer by its name
Definition: hardware_base.cpp:40
HardwareBase()
Definition: hardware_base.cpp:24
SensorBaseConstPtrList getSensorList() const
Definition: hardware_base.h:82
void print(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
Definition: hardware_base.cpp:68
bool hasChildren() const override
Definition: hardware_base.h:94
virtual CheckLog localCheck(bool _verbose, std::ostream &_stream, std::string _tabs="") const
Definition: hardware_base.cpp:81
~HardwareBase() override
Definition: hardware_base.cpp:29
bool check(CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
Definition: hardware_base.cpp:98
virtual void printHeader(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
Definition: hardware_base.cpp:58
Base class for Nodes.
Definition: node_base.h:74
Definition: sensor_base.h:124
Definition: capture_base.h:23